home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / snip9503 / isshift.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-14  |  902 b   |  25 lines

  1. /*-------------------------[ IsShift ]--------------------------*/
  2. /*           Determine whether a shift key is depressed         */
  3. /*              public domain snippet by Jeff Dunlop            */
  4. /*--------------------------------------------------------------*/
  5. /* local:                                                       */
  6. /*      key_flags = pointer to bios shift key area              */
  7. /* return:                                                      */
  8. /*      1 if either shift key is depressed                      */
  9. /*--------------------------------------------------------------*/
  10.  
  11. #if !defined(MK_FP)
  12.     #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off)))
  13. #endif
  14.  
  15. int IsShift(void)
  16. {
  17.     unsigned char far *keyflags = MK_FP(0x40, 0x17);
  18.  
  19.     return (*keyflags & 0x03);
  20. }
  21.  
  22. /* -or?- */
  23.  
  24. #define IsShift ((*MK_FP(0x40, 0x17)) & 0x03)
  25.